//
//@File    :	11.10_mytime3.h
//@Time    :	2021/08/30 13:10:22
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	Time class with friends
//

//三种友元:友元函数,友元类,友元成员函数
//友元函数可以访问类的私有成员
//创建友元:1.将原型放在类声明中,并在原型声明前加关键字friend
//       2.编写函数定义,它不是成员函数不要使用限定符::
#ifndef MYTIME3_H_
#define MYTIME3_H_
#include <iostream>

class Time
{
private:
    int hours;
    int minutes;

public:
    Time();
    Time(int h, int m = 0);
    void AddMin(int m);
    void AddHr(int h);
    void Reset(int h = 0, int m = 0);
    Time operator+(const Time &t) const;
    //加号的时间类运算符重载
    Time operator-(const Time &t) const;
    Time operator*(double n) const;
    friend Time operator*(double m, const Time &t)
    {
        return t * m;
    } //inline deinition
    friend std::ostream &operator<<(std::ostream &os, const Time &t);
    //重载<<运算符
};

#endif // MYTIME3_H_